package com.kehutong.payfees.admin;

//import com.kehutong.common.util.Token;
//import com.kehutong.payfees.entity.ChargeMediationTemplate;
//import com.kehutong.payfees.enums.ChargeLawyerMaterialType;
//import com.kehutong.payfees.enums.TempVar;
//import com.kehutong.payfees.service.ChargeMediationTemplateServiceImpl;
//import org.coraframework.authz.HasPermission;
//import org.coraframework.inject.Inject;
//import org.coraframework.json.JSONObject;
//import org.coraframework.mvc.MvcAction;
//import org.coraframework.mvc.http.Bean;
//import org.coraframework.mvc.http.ReqMapping;
//import org.coraframework.mvc.http.result.Result;
//import org.coraframework.mvc.util.ReqBody;
//import org.coraframework.util.EnumUtil;
//
//import java.util.Arrays;
//
//@MvcAction
//@ReqMapping("/admin/charge/mediation/template")
//public class ChargeMediationTemplateController {
//
//    @Inject
//    private ChargeMediationTemplateServiceImpl chargeMediationTemplateService;
//
//    @Bean(newInstance = true, copy = true)
//    @HasPermission("charge:template:edit")
//    @ReqMapping("/save")
//    public Object saveTemplate(Token token, ChargeMediationTemplate chargeMediationTemplate, JSONObject jsonObject) {
//        chargeMediationTemplate.setCreateBy(token.getUsername());
//        chargeMediationTemplate.setType(EnumUtil.getEnum(ChargeLawyerMaterialType.class, jsonObject.getString("type")));
//        chargeMediationTemplateService.saveTemplate(chargeMediationTemplate);
//        return Result.success();
//    }
//
//    @HasPermission("charge:template:view")
//    @ReqMapping("/get")
//    public Object getTemplate(JSONObject jsonObject) {
//        return Result.success(chargeMediationTemplateService.getTemplate(jsonObject));
//    }
//
//    @HasPermission("charge:template:view")
//    @ReqMapping("/get/enum")
//    public Object getTemplateEnum() {
//        return Result.success(Arrays.asList(TempVar.values()));
//    }
//
//
//    @HasPermission("charge:template:edit")
//    @ReqMapping("/create/file")
//    public Object createFileByTemp(JSONObject jsonObject) throws Exception {
//        chargeMediationTemplateService.createFileByTemp(jsonObject);
//        return Result.success();
//    }
//
//    @ReqMapping(value = "/call/${chargeLawyerMaterialId}", reqBody= ReqBody.JSON)
//    public Object callbackFlowEnd(JSONObject jsonObject, String chargeLawyerMaterialId) throws Exception {
//        chargeMediationTemplateService.callbackFlowEnd(jsonObject, chargeLawyerMaterialId);
//        return Result.success();
//    }
//}
